<?php
namespace Home\Common;

class ConsumeLog extends Mysql{
	
	function __construct(){
		parent::__construct();
	}
	
	function getConsume(){
		$date		=	session('mog_thedate');
		$serverid	=	session('mog_serverid');
		
		$result		=	$this->mysql->prepare("select serverid,type,count(distinct(userid)),count(userid),sum(consume) from mog_consume 
		where date  = \"$date\" and serverid=$serverid 
		group by type");
		$result->execute();
		
		$arResult	=	array();
		
		while($row	=	$result->fetch(\PDO::FETCH_ASSOC)){
			array_push($arResult,array($row['type'],$row['count(distinct(userid))'],$row['count(userid)'],$row['sum(consume)']));
		}
		
		return $arResult;
	}
}
?>